package com.m3839.sdk.common.util;

import android.content.Context;
import android.widget.Toast;

/**
 * Description:ToastUtil
 *
 * @author 陈宝阳
 * @create 2020/8/15 10:45
 */
public class ToastUtil {


  /**
   * 通用方法
   *
   * @param context
   * @param text
   */
  public static void showToast(final Context context, final String text) {
    if(HandlerUtils.isMainThread()) {
      Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
    }else {
      HandlerUtils.runOnMainThread(new Runnable() {
        @Override
        public void run() {
          Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
        }
      });
    }
  }
}
